#include <stdio.h>

struct Xxx {
	int aa;
	double bb[2];
	char *cc;
	char *dd[3];
};

// 定义参数位结构的函数
void function_1(struct Xxx *qq, struct Xxx *rr);

/**
 * 结构和函数
 */
int main() {
	struct Xxx mm, nn;
	// 将变量地址传递到函数
	function_1(&mm, &nn);

	printf("mm: [aa = %d, bb = [%lf, %lf], cc = %s, dd = [%s, %s, %s]]\n",
		   mm.aa, mm.bb[0], mm.bb[1], mm.cc, mm.dd[0], mm.dd[1], mm.dd[2]);
	printf("nn: [aa = %d, bb = [%lf, %lf], cc = %s, dd = [%s, %s, %s]]\n",
		   nn.aa, nn.bb[0], nn.bb[1], nn.cc, nn.dd[0], nn.dd[1], nn.dd[2]);
}

void function_1(struct Xxx *qq, struct Xxx *rr) {
	(*qq).aa = 12;
	(*qq).bb[0] = 23.4;
	(*qq).bb[1] = 34.5;
	(*qq).cc = "Structure";
	(*qq).dd[0] = "passed ";
	(*qq).dd[1] = "to";
	(*qq).dd[2] = "function.";

	rr->aa = 15;
	rr->bb[0] = 45.6;
	rr->bb[1] = 34.5;
	rr->cc = "Pointer ";
	rr->dd[0] = "operators ";
	rr->dd[1] = "can ";
	rr->dd[2] = "be used.";
}

